package edu.stanford.prpl.api;

import java.util.Iterator;
import java.util.List;

public interface QueryResultIterator {

	public interface Solution {
		/**
		 * Return true if the named variable is in this binding
		 */
		public boolean contains(String varName);

		/**
		 * Return the value of the named variable in this binding. A return of null indicates that the variable is
		 * not present in this solution.
		 * 
		 * @param varName
		 * @return RDFNode
		 */
		public Object get(String varName);

		/**
		 * Return the value of the named variable in this binding, casting to a Resource. A return of null
		 * indicates that the variable is not present in this solution. An exception indicates it was present but
		 * not a resource.
		 * 
		 * @param varName
		 * @return Resource
		 */
		public Resource getResource(String varName);

		public BlobResource getBlobResource(String varName);

		/**
		 * Return the internal string representation for the bound variable.
		 * 
		 * @param varName
		 * @return
		 */
		public String getString(String varName);

		/**
		 * Iterate over the variable names (strings) in this QuerySolution.
		 * 
		 * @return Iterator of strings
		 */
		public Iterator<String> varNames();

	}

	/**
	 * Get the variable names for the projection
	 */
	public List<String> getResultVars();

	/**
	 * Return the "row" number for the current iterator item
	 */
	public int getRowNumber();

	public boolean hasNext();

	public boolean isOrdered();

	/**
	 * Moves onto the next result possibility. The returned object should be of class QuerySolution
	 */

	public Solution next();

}
